var color = require('msets.js').color_list;
var clen = color.length;
//数据处理和映射类型文件,根据不同学校处理不同课程信息
function PreClasses(classes) { //或许需要根据不同学校进行处理
  if(classes[0]==null){
    console.log('没课')
    return null;
  }
  console.log(clen)
  let len = classes.length;
  // if(xxx == xxx) 处理该校
  var _classes = [];
  for(var i=0;i<len;i++){
    var tdata = classes[i];
    var _sj = tdata.kcsj;
    var _zc = tdata.kkzc;
    //console.log(timepart);
    tdata.wk = parseInt(_sj[0]);
    tdata.tp = parseInt(_sj.substring(3))/2;
    tdata.startzc = parseInt(_zc.substring(0,2));
    tdata.endzc = parseInt(_zc.substring(3));
    tdata.color = color[parseInt(tdata.kcsj)%clen].name;
    _classes.push(tdata);
  }
  return _classes;
}
function MyFreeSort(a,b){
  return parseInt(a.jsid) < parseInt(b.jsid)?-1:1
}
function PreFreeRoom(freelist){
  var tfree = freelist.sort(MyFreeSort);
  //可以根据不同学校特点处理tfree
  return tfree;
  //
}
//预处理成绩
function PreGrade(grade){
  console.log(grade)
  //
  return grade;
}
module.exports={
  PreClasses:PreClasses,
  PreFreeRoom:PreFreeRoom,
  PreGrade:PreGrade
}